import request from "@/utils/request";
import type {UserVO} from "@/types/vo/UserVO";
import type {UserDTO} from "@/types/dto/UserDTO";
import type {Result} from "@/types/common/Result";

/**
 * 注册
 */
export const registerService = (registerData: UserDTO) => {
  return request.post<Result<UserVO>>('/user/register', registerData)
}

/**
 * 退出登录
 */
export const logoutService = () => {
  return request.post<Result<any>>('/common/login/logout')
}

/**
 * 获取用户信息
 */
export const getUserInfoService = () => {
  return request.get<Result<UserVO>>('/user/info')
}

/**
 * 修改用户信息
 */
export function updateUserService(params: UserDTO) {
  return request.put(`/admin/auth/user/update`, params);
}

/**
 * 获取用户详情
 * @param userId
 */
export function getUserById(userId:number) {
  return request.get<Result<UserVO>>(`/admin/auth/user/get/${userId}`);
}
